home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / c / qtools0.2-src.lha / src / libqsys / m68k / m68k.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-13  |  2.3 KB  |  121 lines

  1. #ifndef    M68K_H
  2. #define    M68K_H
  3.  
  4. #if defined(__mc68020__) && !defined(NOASM)
  5. # define  LZWS
  6. # include "LZW5b.h"
  7. #endif                                /* __mc68020__ */
  8.  
  9. #if defined(BASE_REGISTER) && !defined(NOASM)
  10. # define    __memBase    register struct memory *bspMem __asm__ ("a6")
  11. #endif                                /* BASE_REGISTER */
  12.  
  13. #if defined(INLINE_BIGENDIAN_M68K) && !defined(NOASM)
  14. #if defined(__STDC__) || defined(__cplusplus)
  15. #define _DEFUN(name, args1, args2) name ( args2 )
  16. #define _AND ,
  17. #define _CONST const
  18. #else
  19. #define _DEFUN(name, args1, args2) name args1 args2;
  20. #define _AND ;
  21. #define _CONST
  22. #endif
  23.  
  24. /*
  25.  * define SWAPSHORT(i) (((i>>8)&0xff)|((i<<8)&0xff00))
  26.  */
  27. inline static _CONST unsigned short int _DEFUN(SwapShort, (i), unsigned short int i)
  28. {
  29.   __asm volatile ("        \
  30.     ror%.w #8,%0        \
  31.     "
  32.           :"=d" (i)
  33.           :"0"(i)
  34.           :"cc");
  35.  
  36.   return i;
  37. }
  38.  
  39. /*
  40.  * define SWAPINT(i) (((i>>24)&0xff)|((i>>8)&0xff00)|((i<<8)&0xff0000)|((i<<24)&0xff000000))
  41.  */
  42. inline static _CONST unsigned int _DEFUN(SwapInt, (i), unsigned int i)
  43. {
  44.   __asm volatile ("        \
  45.     ror%.w #8,%0        \
  46.     "
  47.           :"=d" (i)
  48.           :"0"(i)
  49.           :"cc");
  50.   __asm volatile ("        \
  51.     swap %0            \
  52.     "
  53.           :"=d" (i)
  54.           :"0"(i)
  55.           :"cc");
  56.   __asm volatile ("        \
  57.     ror%.w #8,%0        \
  58.     "
  59.           :"=d" (i)
  60.           :"0"(i)
  61.           :"cc");
  62.  
  63.   return i;
  64. }
  65.  
  66. inline static _CONST float _DEFUN(SwapFloat, (i), float i)
  67. {
  68.   __asm volatile ("        \
  69.     ror%.w #8,%0        \
  70.     "
  71.           :"=d" (i)
  72.           :"0"(i)
  73.           :"cc");
  74.   __asm volatile ("        \
  75.     swap %0            \
  76.     "
  77.           :"=d" (i)
  78.           :"0"(i)
  79.           :"cc");
  80.   __asm volatile ("        \
  81.     ror%.w #8,%0        \
  82.     "
  83.           :"=d" (i)
  84.           :"0"(i)
  85.           :"cc");
  86.  
  87.   return i;
  88. }
  89.  
  90. #undef _DEFUN
  91. #undef _AND
  92. #undef _CONST
  93. #endif
  94.  
  95. /*
  96.  * ============================================================================
  97.  * structures
  98.  * ============================================================================
  99.  */
  100.  
  101. /*
  102.  * ============================================================================
  103.  * globals
  104.  * ============================================================================
  105.  */
  106.  
  107. /*
  108.  * ============================================================================
  109.  * prototypes
  110.  * ============================================================================
  111.  */
  112.  
  113. #ifndef NOASM
  114. #define    MATCH
  115. #undef    Match
  116. unsigned char Match(register struct rgb *rawpix __asm__("a0"), register struct rgb *Palette __asm__("a1"));
  117.  
  118. #endif
  119.  
  120. #endif
  121.